import request from '@/utils/request'
import { http_URL } from '@/utils/global'

function ajax(url, method, data) {
  if (method === 'get') {
    return request({
      url: http_URL + url,
      method: 'get',
      params: data
    })
  } else {
    return request(
      {
        url: http_URL + url,
        method: 'post',
        data: data // es6 同名可以省略
      }
    )
  }
}

/**
 * 订单列表
 * @param data
 * @returns {AxiosPromise}
 */
export function getOrderList(data) {
  return ajax('/p/order/orderList', 'get', data)
}
